package com.cll.learn.provider.service.impl;

import com.cll.learn.api.service.DemoService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Component;

import java.util.Random;

/**
 * 描述信息:
 *
 * @author CLL
 * @version 1.0
 * @date 2020/10/10 10:04
 */
@DubboService(interfaceClass = DemoService.class, version = "1.2.0")
@Component
public class DemoServiceImpl implements DemoService {

    @Override
    public String methodA(String param) {
        int i = new Random().nextInt(100);
        try {
            Thread.sleep(i);
            return "methodA" + param + "[" + i + "]";
        } catch (InterruptedException ie) {
            ie.printStackTrace();
        }
        return null;
    }

    @Override
    public String methodB(String param) {
        int i = new Random().nextInt(100);
        try {
            Thread.sleep(i);
            return "methodB" + param + "[" + i + "]";
        } catch (InterruptedException ie) {
            ie.printStackTrace();
        }
        return null;
    }

    @Override
    public String methodC(String param) {
        int i = new Random().nextInt(100);
        try {
            Thread.sleep(i);
            return "methodC" + param + "[" + i + "]";
        } catch (InterruptedException ie) {
            ie.printStackTrace();
        }
        return null;
    }
}
